package com.example.demo.demos.web.mapper;

import com.example.demo.demos.web.entity.Zl;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ZlMapper {
    @Insert("insert into zldd (id,zlsj,ghsj, username,name,phone,sfz,status,shhf,remark,uid,carid,price) VALUES (#{id},#{zlsj},#{ghsj}, #{username},#{name},#{phone},#{sfz},#{status},#{shhf},#{remark},#{uid},#{carid},#{price})")
    Integer addzl(Zl zl);
    @Select("select * from zldd ,car,user where zldd.carid = car.id and zldd.uid = user.id limit #{pageNum}, #{pageSize}")
    List<Zl> selectzl(@Param("pageNum") Integer pageNum,@Param("pageSize") Integer pageSize);
    @Select("select count(*) from zldd ,car,user where zldd.carid = car.id and zldd.uid = user.id")
    Integer selectnum();
    @Update("update  zldd set status =#{status},remark=#{remark} where id=#{id}")
    Integer update(Zl zl);
    @Select("select * from zldd JOIN car on zldd.carid = car.id where uid =#{uid}")
    List<Zl> selectzluser(@Param("uid") String uid);
    @Select("select * from zldd JOIN car on zldd.carid = car.id where uid =#{uid} and zldd.status = '3'")
    List<Zl> selectzluser1(@Param("uid") String uid);



}
